package me.mononin.factory.preseneter.message;

import me.mononin.factory.data.helper.UserHelper;
import me.mononin.factory.data.message.MessageDataSource;
import me.mononin.factory.data.message.MessageRepository;
import me.mononin.factory.model.db.Message;
import me.mononin.factory.model.db.User;

public class ChatUserPresenter extends ChatPresenter<ChatContract.UserView> {

    public ChatUserPresenter(ChatContract.UserView view, String receiverId) {
        //传递用户数据源，View，接收者Id，消息接收类型
        super(new MessageRepository(receiverId), view, receiverId, Message.RECEIVER_TYPE_NONE);
    }


    @Override
    public void start() {
        super.start();
        //获取接收者
        User receiver = UserHelper.findFromLocal(mReceiverId);
        //初始化聊天界面
        getView().onInit(receiver);
    }
}
